package com.iyimo.scene
{
	import flash.display.DisplayObjectContainer;
	/**
	 * 加载文件,初始化scene的切换器,nextScene会在加载完成后callback某个函数.
	 * 看是继承某个接口,还是写在scene里
	 */
	public class SceneSwitcher{
		public static var currScene:BaseScene;
		public static var parent:DisplayObjectContainer;
		
		/**
		 * 初始化第一个场景
		 * @param scene
		 */			
		public static function initalize(scene:BaseScene, root:DisplayObjectContainer):void{
			scene.initalize(root);
			parent = root;
			currScene = scene;
		}
		
		public static function action(nextScene:BaseScene, callBack:Function):void{
			currScene.clear();
			nextScene.initalize(parent);
			currScene = nextScene;
		}
	}
}